import 'dart:convert' show json;

class NovelInfo {
  int code;
  String msg;
  List<NovelItem> data;

  NovelInfo.fromParams({this.code, this.msg, this.data});

  factory NovelInfo(jsonStr) => jsonStr == null
      ? null
      : jsonStr is String
          ? new NovelInfo.fromJson(json.decode(jsonStr))
          : new NovelInfo.fromJson(jsonStr);

  NovelInfo.fromJson(jsonRes) {
    code = jsonRes['code'];
    msg = jsonRes['msg'];
    data = jsonRes['data'] == null ? null : [];

    for (var dataItem in data == null ? [] : jsonRes['data']) {
      data.add(dataItem == null ? null : new NovelItem.fromJson(dataItem));
    }
  }

  @override
  String toString() {
    return '{"code": $code,"msg": ${msg != null ? '${json.encode(msg)}' : 'null'},"data": $data}';
  }
}

class NovelItem {
  int date_updated;
  int discountNum;
  int is_new;
  int quick_price;
  bool isShortStory;
  String audiobook_playCount;
  String author;
  String author_name;
  String bid;
  String book_cover;
  String book_info;
  String bookname;
  String chapterNum;
  String chapterid;
  String chapterid_first;
  String chargeMode;
  String class_name;
  String digest;
  String first_cate_id;
  String first_cate_name;
  String formats;
  String introduction;
  String num_click;
  String praiseCount;
  String price;
  String readCount;
  String reason;
  String recommend_num;
  String search_heat;
  String size;
  String stat_name;
  String state;
  String top_class;
  String topic;
  String topic_first;
  String userid;
  List<String> tag;

  NovelItem.fromParams(
      {this.date_updated,
      this.discountNum,
      this.is_new,
      this.quick_price,
      this.isShortStory,
      this.audiobook_playCount,
      this.author,
      this.author_name,
      this.bid,
      this.book_cover,
      this.book_info,
      this.bookname,
      this.chapterNum,
      this.chapterid,
      this.chapterid_first,
      this.chargeMode,
      this.class_name,
      this.digest,
      this.first_cate_id,
      this.first_cate_name,
      this.formats,
      this.introduction,
      this.num_click,
      this.praiseCount,
      this.price,
      this.readCount,
      this.reason,
      this.recommend_num,
      this.search_heat,
      this.size,
      this.stat_name,
      this.state,
      this.top_class,
      this.topic,
      this.topic_first,
      this.userid,
      this.tag});

  NovelItem.fromJson(jsonRes) {
    date_updated = jsonRes['date_updated'];
    discountNum = jsonRes['discountNum'];
    is_new = jsonRes['is_new'];
    quick_price = jsonRes['quick_price'];
    isShortStory = jsonRes['isShortStory'];
    audiobook_playCount = jsonRes['audiobook_playCount'];
    author = jsonRes['author'];
    author_name = jsonRes['author_name'];
    bid = jsonRes['bid'];
    book_cover = jsonRes['book_cover'];
    book_info = jsonRes['book_info'];
    bookname = jsonRes['bookname'];
    chapterNum = jsonRes['chapterNum'];
    chapterid = jsonRes['chapterid'];
    chapterid_first = jsonRes['chapterid_first'];
    chargeMode = jsonRes['chargeMode'];
    class_name = jsonRes['class_name'];
    digest = jsonRes['digest'];
    first_cate_id = jsonRes['first_cate_id'];
    first_cate_name = jsonRes['first_cate_name'];
    formats = jsonRes['formats'];
    introduction = jsonRes['introduction'];
    num_click = jsonRes['num_click'];
    praiseCount = jsonRes['praiseCount'];
    price = jsonRes['price'];
    readCount = jsonRes['readCount'];
    reason = jsonRes['reason'];
    recommend_num = jsonRes['recommend_num'];
    search_heat = jsonRes['search_heat'];
    size = jsonRes['size'];
    stat_name = jsonRes['stat_name'];
    state = jsonRes['state'];
    top_class = jsonRes['top_class'];
    topic = jsonRes['topic'];
    topic_first = jsonRes['topic_first'];
    userid = jsonRes['userid'];
    tag = jsonRes['tag'] == null ? null : [];

    for (var tagItem in tag == null ? [] : jsonRes['tag']) {
      tag.add(tagItem);
    }
  }

  @override
  String toString() {
    return '{"date_updated": $date_updated,"discountNum": $discountNum,"is_new": $is_new,"quick_price": $quick_price,"isShortStory": $isShortStory,"audiobook_playCount": ${audiobook_playCount != null ? '${json.encode(audiobook_playCount)}' : 'null'},"author": ${author != null ? '${json.encode(author)}' : 'null'},"author_name": ${author_name != null ? '${json.encode(author_name)}' : 'null'},"bid": ${bid != null ? '${json.encode(bid)}' : 'null'},"book_cover": ${book_cover != null ? '${json.encode(book_cover)}' : 'null'},"book_info": ${book_info != null ? '${json.encode(book_info)}' : 'null'},"bookname": ${bookname != null ? '${json.encode(bookname)}' : 'null'},"chapterNum": ${chapterNum != null ? '${json.encode(chapterNum)}' : 'null'},"chapterid": ${chapterid != null ? '${json.encode(chapterid)}' : 'null'},"chapterid_first": ${chapterid_first != null ? '${json.encode(chapterid_first)}' : 'null'},"chargeMode": ${chargeMode != null ? '${json.encode(chargeMode)}' : 'null'},"class_name": ${class_name != null ? '${json.encode(class_name)}' : 'null'},"digest": ${digest != null ? '${json.encode(digest)}' : 'null'},"first_cate_id": ${first_cate_id != null ? '${json.encode(first_cate_id)}' : 'null'},"first_cate_name": ${first_cate_name != null ? '${json.encode(first_cate_name)}' : 'null'},"formats": ${formats != null ? '${json.encode(formats)}' : 'null'},"introduction": ${introduction != null ? '${json.encode(introduction)}' : 'null'},"num_click": ${num_click != null ? '${json.encode(num_click)}' : 'null'},"praiseCount": ${praiseCount != null ? '${json.encode(praiseCount)}' : 'null'},"price": ${price != null ? '${json.encode(price)}' : 'null'},"readCount": ${readCount != null ? '${json.encode(readCount)}' : 'null'},"reason": ${reason != null ? '${json.encode(reason)}' : 'null'},"recommend_num": ${recommend_num != null ? '${json.encode(recommend_num)}' : 'null'},"search_heat": ${search_heat != null ? '${json.encode(search_heat)}' : 'null'},"size": ${size != null ? '${json.encode(size)}' : 'null'},"stat_name": ${stat_name != null ? '${json.encode(stat_name)}' : 'null'},"state": ${state != null ? '${json.encode(state)}' : 'null'},"top_class": ${top_class != null ? '${json.encode(top_class)}' : 'null'},"topic": ${topic != null ? '${json.encode(topic)}' : 'null'},"topic_first": ${topic_first != null ? '${json.encode(topic_first)}' : 'null'},"userid": ${userid != null ? '${json.encode(userid)}' : 'null'},"tag": $tag}';
  }
}
